14 February 2018

Inputs and outputs

The inputs consist of four radio buttons and a slider.

  • The radio buttons are used to select a weather variable.
  • The slider is used to select a sample size between 1 and 100.
  • When the user clicks the "Create plots" button, a sample of households of the selected size is taken from the dataset, and the energy consumption is summed over these households. A new sample is taken each time the button is clicked.

The app then creates two plots.

  • The first is a plot of the aggregated consumption against the selected weather variable, fitted with a linear model.
  • The second plot shows the energy consumption profile for a typical winter day, aggregated over the chosen sample.

First plot

The correlation becomes more consistent as the sample size increases. Here is an example with temperature - 3 samples of size 1 produce 3 very different results, but as the sample size increases to 100 the relationship converges to the lower graph:

Summary table

Beneath the first plot is a summary table for the linear model, along with a sentence stating whether or not the correlation is statistically significant. Here is an example for the lower graph on the previous slide. The linear model object is mod.

cat(if (summary(mod)$coeff[2, 4] < 0.05) {
    paste0("p = ", signif(summary(mod)$coeff[2, 4], 2), ", so there", 
        " is a statistically significant correlation\nbetween temp", 
        " and kWh in this sample.")
} else {
    paste0("p = ", signif(summary(mod)$coeff[2, 4], 2), ", so there", 
        " is no correlation between temp and kWh in\nthis sample.")
})
## p = 3.7e-222, so there is a statistically significant correlation
## between temp and kWh in this sample.

Second plot

The consumption profile becomes more predictable as the sample size increases. Here is an example: 3 distinct households have very different profiles, but as the sample size increases to 100 the aggregate consumption converges to the lower profile.